<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // let num = 1
        // function fn(){
        //     console.log(num);

        //     num++

        //     // if(num >=500) return
        //     fn()
        // }
        // fn()

        const cai = {
            uname: '只因',
            age: 2.5,
            hobbit: ['sing', 'dance', 'rap', 'basketball'],
            fans: {
                uname: 'ikun',
                age: 9999,
                hobbit: ['smoke', 'drink', 'makeHairStyle'],
            },
        }

        const feng = {}
        function deepClone(newObj, oldObj) {
            // console.log(oldObj);
            for (let key in oldObj) {

                if (oldObj[key] instanceof Array) {
                    newObj[ley] = []
                    deepClone(newObj[key], oldObj[key])

                } else if (newObj[key] instanceof Object) {
                    newObj[ley] = {}
                    deepClone(newObj[key], oldObj[key])
                } else {
                    newObj[key] = oldobj[key]
                }
            }
        }

        deepClone(feng,cai)

        // fang.fans.hobbit[2]
    </script>
</body>

</html>